﻿<!--#include file="inc/common.asp" -->
<%
'生成RSS2.0格式文件
'
'author: evan zhao
'

  call openDB
    
  '是否只截取内容摘要
  dim doTrim
  doTrim = request.queryString("trim")
  if doTrim="true" then
      doTrim = true
  else
      doTrim = false
  end if
    
  response.contentType="text/xml"
  response.charset=DEFAULT_CHARSET
  response.AddHeader "Content-Disposition", "inline; filename=misslog.rss" 
  response.AddHeader "Last-Modified", DateToGMT(Now())
  response.Expires = 60
  response.CacheControl = "public"  
  response.write "<?xml version='1.0' encoding='" & DEFAULT_CHARSET & "' ?>"
%>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
  <title><![CDATA[<%=hostTitle%>]]></title> 
  <link><%=baseURL%>/index.asp?blog_id=<%=blogObj.blogId%></link> 
  <description><![CDATA[<%=hostDescription%>]]></description> 
  <language>zh-cn</language> 
  <image>
      <title><![CDATA[<%=hostTitle%>]]></title> 
      <url>http://www.misslog.com/blog/images/heart.gif</url> 
      <width>14</width> 
      <height>14</height> 
      <link><%=baseURL%>/index.asp?blog_id=<%=blogObj.blogId%></link> 
  </image>
  <copyright>Copyright 2003~2004 misslog.com</copyright> 
  <ttl>30</ttl>
<%
  dim blog_id, cat_id, blog_title, content_id, title, excerpt, detail, reply_count, insert_time, user_name, lastBuildDate
  dim summary
  
  blog_id=request.queryString("blog_id")
  cat_id=request.queryString("cat_id")
  
  sql = " select top 10 a.content_id,  a.title,  a.excerpt, a.detail, a.reply_count, a.insert_time, a.user_name, a.cat_id, b.blog_id, b.blog_title from blog_content a , blog b, blog_user_group c  where a.blog_id=b.blog_id and b.blog_id=c.blog_id and c.group_id=4 and c.can_read=true and a.is_secret=false "

  if not isEmpty(blog_id) and blog_id<>"" then
    sql = sql & " and a.blog_id=" & clng(blog_id)
  end if
  
  if not isEmpty(cat_id) and cat_id<>"" then
    sql = sql & " and a.cat_id=" & clng(cat_id)
  end if

  sql = sql & " order by a.insert_time desc"
  
  rs.open sql,conn,1,1
  set content_id  = rs("content_id")
  set title  = rs("title")
  set excerpt = rs("excerpt")
  set detail = rs("detail")
  set reply_count = rs("reply_count")
  set insert_time  = rs("insert_time")
  set user_name  = rs("user_name")
  set blog_id  = rs("blog_id")
  set blog_title  = rs("blog_title")
  if rs.eof then
%>
 <item>
  <title>暂时没有内容</title> 
  <link><%=baseURL%></link> 
 </item>
<%
  else 
    lastBuildDate = insert_time
    

    
    do until rs.eof
        summary = excerpt
        if isNull(summary) or isEmpty(summary) or trim(summary)="" then
            summary = detail
            if doTrim and strlen(summary)>150 then
                summary = strleft(summary, 150) & " <span>...</span>"
            end if
        else    
            if doTrim then
                summary = summary & " <span>...</span>"
            else
                summary = summary & " <br><br> " & detail
            end if    
        end if
        summary = summary & " <p><a href='" & baseURL & "/detail.asp?blog_id=" & blog_id & "&content_id=" & content_id & "'>详细阅读</a>"
%>
  <item>
    <title><![CDATA[<%=title%>]]></title> 
    <link><%=baseURL%>/detail.asp?blog_id=<%=blog_id%>&amp;content_id=<%=content_id%></link> 
    <description><![CDATA[<%=summary%>]]> </description>
    <pubDate><%=DateToGMT(insert_time)%></pubDate> 
    <guid isPermaLink="true"><%=baseURL%>/detail.asp?blog_id=<%=blog_id%>&amp;content_id=<%=content_id%></guid>
    <author><![CDATA[<%=user_name%>]]></author>    
    <comments><%=baseURL%>/reply.asp?blog_id=<%=blog_id%>&amp;content_id=<%=content_id%></comments>
    <slash:comments><%=reply_count%></slash:comments>
    <dc:subject><![CDATA[<%
        if isEmpty(request.queryString("blog_id")) then
            response.write("" & blog_title & "")
        end if    
    %>]]></dc:subject>    
  </item>
<%
      rs.moveNext()
    loop
%>
  <pubDate><%=DateToGMT(lastBuildDate)%></pubDate> 
  <lastBuildDate><%=DateToGMT(lastBuildDate)%></lastBuildDate> 
<%
  end if

  if not userObj.isFound then
    Session.Abandon   
  end if  
%>
</channel>
</rss>

<!--#include file="inc/end.asp" -->
